package com.cares.common.action;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 
 * @author xuji
 * Action基类
 */
public class DefaultAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	HttpServletResponse response;
	
	public HttpServletResponse getResponse(){
		response = ServletActionContext.getResponse();
		response.setContentType("text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        return response;
	}


	/**
	 * 地址重定向
	 * @param url
	 */
	public void redirectSysAction(String url) {
		try {
			response = getResponse();
			response.sendRedirect(url);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	

}
